package com.example.demo.controller;

import com.example.demo.model.Result;
import com.example.demo.service.DashboardService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dashboard")
@AllArgsConstructor
public class DashboardController {
    DashboardService dashboardService;
    @GetMapping
    public Result getShowInfo(){
        return dashboardService.getShowInfo();
    }

    @GetMapping("/everyweek")
    public Result everyDayAddOfWeek(){//一周以内每天新增用户的数量
        return dashboardService.getEveryWeekAdd();
    }
    @GetMapping("/everymonth")
    public Result everyDayAddOfMonth(){//一个月以内每天新增的用户数量
        return dashboardService.getEveryMonthAdd();
    }
    @GetMapping("/everyweek-total")
    public Result everyDayTotalSalesOfWeek(){//一周以内每天的销售额
        return dashboardService.getEveryWeekTotalSales();
    }
}
